"use strict";

const env = process.env.mode || "dev";
const winston = require("winston");
const path = require("path");
const config = require(path.join("..", "..", "config", env, "logger"))[env];

let logger = function() {
  let transports;
  if (Array.isArray(config)) {
    transports = [];
    config.forEach(function(c) {
      transports.push(new (winston.transports.File)(c));
    });
  } else {
    transports = new (winston.transports.File)(config);
  }
  return new (winston.Logger)({
    transports: transports
  });
};
module.exports = logger;
